Use strncmp to compare array to string (#545)
authorJochen Sprickerhof <git@jochen.sprickerhof.de>
Mon, 25 May 2020 15:08:13 +0000 (17:08 +0200)
committerGitHub <noreply@github.com>
Mon, 25 May 2020 15:08:13 +0000 (09:08 -0600)
v900.cc

diff --git a/v900.cc b/v900.cc
index 5766030c92162da76a5d70adab20698d03c95626..18f3a1f320076c0cfe2254852242f1769095c6ae 100644 (file)
--- a/v900.cc
+++ b/v900.cc
@@ -328,11 +328,11 @@ v900_read()
       wpt->pdop = atof(line.adv.pdop);
 
       /* handle fix mode (2d, 3d, etc.) */
-      if (!strcmp(line.adv.valid,"DGPS")) {
+      if (!strncmp(line.adv.valid,"DGPS", sizeof line.adv.valid)) {
         wpt->fix = fix_dgps;
-      } else if (!strcmp(line.adv.fixmode,"3D")) {
+      } else if (!strncmp(line.adv.fixmode,"3D", sizeof line.adv.fixmode)) {
         wpt->fix = fix_3d;
-      } else if (!strcmp(line.adv.fixmode,"2D")) {
+      } else if (!strncmp(line.adv.fixmode,"2D", sizeof line.adv.fixmode)) {
         wpt->fix = fix_2d;
       } else
         /* possible values: fix_unknown,fix_none,fix_2d,fix_3d,fix_dgps,fix_pps */